package com.zx.mes.rabbitmq.hyl.object;


import com.zx.mes.rabbitmq.hyl.model.Person;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * hello 消息发送
 * @author hyl
 * @date 2018-3-16
 */
@Component
public class ObjectProduce {

    private static final Logger logger = LoggerFactory.getLogger(ObjectProduce.class);

    @Autowired
    private AmqpTemplate rabbitmqTemplate;

    public void send(){
        Person person=new Person();
        person.setName("神一般的存在");
        person.setAge(20);
        logger.info("object {}",person);
        this.rabbitmqTemplate.convertAndSend("object",person);
    }
}
